.class public Lcom/instagram/android/explore/i;
.super Landroid/widget/ArrayAdapter;
.source "RandomizingPhotoListAdapter.java"


# annotations
.annotation system Ldalvik/annotation/Signature;
    value = {
        "Landroid/widget/ArrayAdapter",
        "<",
        "Lcom/instagram/android/model/n;",
        ">;"
    }
.end annotation


# instance fields
.field private final a:Ljava/util/Random;

.field private b:Lcom/instagram/android/model/n;

.field private c:I


# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .locals 1
    .parameter

    .prologue
    const/4 v0, 0x0

    .line 23
    invoke-direct {p0, p1, v0}, Landroid/widget/ArrayAdapter;-><init>(Landroid/content/Context;I)V

    .line 20
    iput v0, p0, Lcom/instagram/android/explore/i;->c:I

    .line 25
    new-instance v0, Ljava/util/Random;

    invoke-direct {v0}, Ljava/util/Random;-><init>()V

    iput-object v0, p0, Lcom/instagram/android/explore/i;->a:Ljava/util/Random;

    .line 26
    return-void
.end method


# virtual methods
.method public a(I)Lcom/instagram/android/model/n;
    .locals 1
    .parameter

    .prologue
    .line 45
    iget-object v0, p0, Lcom/instagram/android/explore/i;->b:Lcom/instagram/android/model/n;

    return-object v0
.end method

.method public a(Lcom/instagram/android/model/n;)V
    .locals 2
    .parameter

    .prologue
    .line 29
    iput-object p1, p0, Lcom/instagram/android/explore/i;->b:Lcom/instagram/android/model/n;

    .line 32
    iget-object v0, p0, Lcom/instagram/android/explore/i;->b:Lcom/instagram/android/model/n;

    invoke-virtual {v0}, Lcom/instagram/android/model/n;->c()Ljava/util/List;

    move-result-object v0

    invoke-interface {v0}, Ljava/util/List;->size()I

    move-result v0

    div-int/lit8 v0, v0, 0x5

    iget-object v1, p0, Lcom/instagram/android/explore/i;->b:Lcom/instagram/android/model/n;

    invoke-virtual {v1}, Lcom/instagram/android/model/n;->d()Ljava/util/List;

    move-result-object v1

    invoke-interface {v1}, Ljava/util/List;->size()I

    move-result v1

    invoke-static {v0, v1}, Ljava/lang/Math;->min(II)I

    move-result v0

    iput v0, p0, Lcom/instagram/android/explore/i;->c:I

    .line 35
    invoke-virtual {p0}, Lcom/instagram/android/explore/i;->notifyDataSetChanged()V

    .line 36
    return-void
.end method

.method public getCount()I
    .locals 1

    .prologue
    .line 40
    iget v0, p0, Lcom/instagram/android/explore/i;->c:I

    return v0
.end method

.method public synthetic getItem(I)Ljava/lang/Object;
    .locals 1
    .parameter "x0"

    .prologue
    .line 15
    invoke-virtual {p0, p1}, Lcom/instagram/android/explore/i;->a(I)Lcom/instagram/android/model/n;

    move-result-object v0

    return-object v0
.end method

.method public getView(ILandroid/view/View;Landroid/view/ViewGroup;)Landroid/view/View;
    .locals 5
    .parameter "position"
    .parameter "convertView"
    .parameter "parent"

    .prologue
    const/4 v1, 0x0

    .line 50
    if-nez p2, :cond_0

    .line 51
    new-instance p2, Lcom/instagram/android/explore/widget/a;

    .end local p2
    invoke-virtual {p0}, Lcom/instagram/android/explore/i;->getContext()Landroid/content/Context;

    move-result-object v0

    invoke-direct {p2, v0}, Lcom/instagram/android/explore/widget/a;-><init>(Landroid/content/Context;)V

    .line 54
    .restart local p2
    :cond_0
    check-cast p2, Lcom/instagram/android/explore/widget/a;

    .line 56
    .end local p2
    const/4 v0, 0x6

    new-array v2, v0, [Ljava/lang/String;

    .line 57
    iget-object v0, p0, Lcom/instagram/android/explore/i;->b:Lcom/instagram/android/model/n;

    invoke-virtual {v0}, Lcom/instagram/android/model/n;->d()Ljava/util/List;

    move-result-object v0

    invoke-interface {v0, p1}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/lang/String;

    aput-object v0, v2, v1

    .line 58
    :goto_0
    const/4 v0, 0x5

    if-ge v1, v0, :cond_1

    .line 59
    add-int/lit8 v3, v1, 0x1

    iget-object v0, p0, Lcom/instagram/android/explore/i;->b:Lcom/instagram/android/model/n;

    invoke-virtual {v0}, Lcom/instagram/android/model/n;->c()Ljava/util/List;

    move-result-object v0

    mul-int/lit8 v4, p1, 0x5

    add-int/2addr v4, v1

    invoke-interface {v0, v4}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/lang/String;

    aput-object v0, v2, v3

    .line 58
    add-int/lit8 v0, v1, 0x1

    move v1, v0

    goto :goto_0

    .line 61
    :cond_1
    invoke-virtual {p2, v2}, Lcom/instagram/android/explore/widget/a;->setPhotoUrls([Ljava/lang/String;)V

    .line 62
    iget-object v0, p0, Lcom/instagram/android/explore/i;->a:Ljava/util/Random;

    invoke-virtual {v0}, Ljava/util/Random;->nextBoolean()Z

    move-result v0

    iget-object v1, p0, Lcom/instagram/android/explore/i;->a:Ljava/util/Random;

    invoke-virtual {v1}, Ljava/util/Random;->nextBoolean()Z

    move-result v1

    invoke-virtual {p2, v0, v1}, Lcom/instagram/android/explore/widget/a;->a(ZZ)V

    .line 64
    return-object p2
.end method
